﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace gk.Games.SudokuSolver
{
    public class SudokuSolver
    {
        private SudokuPuzzle mPuzzle;
        public SudokuSolver(string gameData)
        {
            mPuzzle = new SudokuPuzzle(gameData);
        }

        public string Solve()
        {
            int numberOfSolved = mPuzzle.NumberOfSolvedCells();
            while (!mPuzzle.IsSolved())
            {
                mPuzzle.Solve();
                int tmp = mPuzzle.NumberOfSolvedCells();
                //if (numberOfSolved >= tmp) break;
                numberOfSolved = tmp;
                
            }
            return mPuzzle.ToString();            
        }


    }
}
